package edu.nf.relaxenjoy.service;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @author zhu
 * @date 2024-12-16
 */
@Component
@RequiredArgsConstructor
public class PlatformProducer {

    private final RabbitTemplate rabbitTemplate;

    /**
     * 发送消息的方法
     * @param exchange 交换机
     * @param routingKey 路由key
     * @param message 消息
     * @return 发送消息
     */
    public boolean sendMessage(String exchange,String routingKey,Object message) {
        rabbitTemplate.convertAndSend(exchange,routingKey,message);
        return true;
    }
}
